<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Random" %>
<!doctype html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <jsp:include page="/manage/inc/header"></jsp:include>
</head>
<body>
<%
    Date d = new Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String now = df.format(d);
%>
<%
    Date a = new Date();
    SimpleDateFormat aa = new SimpleDateFormat("MMdd");
    String bb = aa.format(a);
    Random c = new Random();
    Integer w =c.nextInt(100);//若要生成1-100的随机数则改为a.nextInt(100)+1即可

%>

    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="/jscss/admin/design/">管理员管理</a><span class="crumb-step">&gt;</span><span>添加管理员</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<%=path%>/manage/admin/insert" class="form"  method="post">
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <th><i class="require-red">*</i>管理员姓名：</th>
                            <td>
                                <input class="common-text required" id="name" name="name" size="50" value="" type="text"><span id="n"></span>
                            </td>
                        </tr>
                            <th><i class="require-red">*</i>管理员登陆账户:</th>
                            <td>
                                <input class="common-text required"  id="account" name="aa" size="50" value="<%=bb%><%=w%>" type="text">
                            </td>
                            </tr>
                        <tr>
                            <th><i class="require-red">*</i>默认密码：</th>
                            <td><input class="common-text" id="password" name="password" value="<%=bb%><%=w%>" size="50"  type="password">
                                <span id="p"></span></td>
                        </tr>
                            <tr>
                                <th><i class="require-red">*</i>确认默认密码：</th>
                                <td><input class="common-text" id="queren" size="50"  type="password"><span id="q"></span></td>
                            </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                            </td>
                        </tr>
                        </tbody></table>
                </form>
            </div>
        </div>
    </div>
    <!--/main-->
</div>
</body>
<script type="text/javascript" src="<%=path%>/Manage/static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=path%>/Manage/static/h-ui/js/H-ui.min.js"></script>
<script>
    $(function () {
        var err_name=false;
        var err_que=false;
      $("#name").blur(function () {
          var name = $("#name").val();
          var reg = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/;
          var flag = reg.test(name);
          if(flag==true){
              $("#n").html("√");
              $("#n").css("color","green");
              err_name=true;
          }
          else{
              $("#n").html("请输入正确格式");
              $("#n").css("color","red");
              err_name=false;
          }
      })
        $("#account").blur(function () {
            var account = $("#account").val();
        })
        $("#queren").blur(function () {
            var password=$("#password").val();
            var pass = $("#queren").val();
            if(password==pass){
                $("#q").html("√");
                $("#q").css("color","green");
                err_que=true;
            }
            else {
                $("#q").html("两次密码不一致");
                $("#q").css("color","red");
                err_que=false;
            }
        })
        $(".form").submit(function () {
            if(err_name==true&&err_que==true){
                return true;
            }
            else {
                return false;
            }
        })
    })

</script>
</html>